import { createRouter, createWebHashHistory } from "vue-router";
import HomeView from "../views/HomeView.vue";
import HeaderComp from "@/components/HeaderComp.vue";
import FooterComp from "@/components/FooterComp.vue";
import ClassificationView from "@/views/ClassificationView.vue"
import CartView from "@/views/CartView.vue"
import LoginView from "@/views/LoginView.vue";
import UserCenterView from "@/views/UserCenterView.vue";
import RegistView from "@/views/RegistView.vue";
import CityView from "@/views/CityView.vue"
import DetailView from "@/views/DetailView.vue";
import SearchView from "@/views/SearchView.vue"
import NotFound from "@/views/NotFound.vue"
import BadService from "@/views/BadService.vue"

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: "/",
      name: "home",
      components: {
        default: HomeView,
        header: HeaderComp,
        footer: FooterComp,
      },
    },
    {
      path: "/class",
      name: "class",
      components: {
        default: ClassificationView,
        footer: FooterComp,
      }
    },
    {
      path: "/car",
      name: "cart",
      components: {
        default: CartView,
        footer: FooterComp,
      }
    },
    {
      path: "/login",
      name: "login",
      components: {
        default: LoginView,
        footer: FooterComp
      }
    },
    {
      path: "/city",
      name: "city",
      component: CityView
    },
    {
      path: "/user",
      name: "user",
      components: {
        default: UserCenterView,
        footer: FooterComp
      }
    },
    {
      path: "/regist",
      name: "regist",
      component: RegistView,
    },

    {
      path: "/detail",
      name: "detail",
      component: DetailView,
    },
    {
      path: "/search",
      name: "search",
      component: SearchView,
    },
    {
      path: "/:pathMatch(.*)*",
      name: "notfound",
      component: NotFound
    },
    {
      path: "/503",
      name: "badservice",
      component: BadService
    }
  ],
});

export default router;
